package com.woniuxy.service.impl;

import com.woniuxy.entity.Address;
import com.woniuxy.mapper.AddressMapper;
import com.woniuxy.service.AddressService;
import com.woniuxy.utils.ResponseResults;
import com.woniuxy.utils.ResponseState;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AddressServiceImpl implements AddressService {

    @Resource
    private AddressMapper addressMapper;


    @Override
    public ResponseResults<List<Address>> findAddressByUid(int getuid) {

        List<Address> addresses = addressMapper.selectAddressByUid(getuid);

        return new ResponseResults<List<Address>>()
                .setCode(200)
                .setState(ResponseState.SELECT_SUCCESS)
                .setMsg("查询成功")
                .setData(addresses);
    }

    @Override
    public Address findAddressById(int aid) {
        return addressMapper.selectAddressById(aid);
    }
}
